﻿#pragma once

#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "CSUnrealSharpEditorSettings.generated.h"

UENUM()
enum EAutomaticHotReloadMethod : uint8
{
	// Automatically Hot Reloads when script changes are saved
	OnScriptSave,
	// Automatically Hot Reloads when the built .NET modules changed (build the C# project in your IDE and UnrealSharp will automatically reload)
	OnModuleChange,
	// Wait for the Editor to gain focus before Hot Reloading
	OnEditorFocus,
	// Will not Hot Reload automatically
	Off,
};

UENUM()
enum ECSBuildConfiguration : uint8
{
	Debug,
	Release,
};

UENUM()
enum ECSLoggerVerbosity : uint8
{
	// The most minimal output
	Quiet,
	
	// Relatively little output
	Minimal,
	
	// Standard output. This should be the default if verbosity level is not set
	Normal,
	
	// Relatively verbose, but not exhaustive
	Detailed,
	
	// The most verbose and informative verbosity
	Diagnostic
};

UCLASS(config = EditorPerProjectUserSettings, meta = (DisplayName = "UnrealSharp Editor Settings"))
class UNREALSHARPEDITOR_API UCSUnrealSharpEditorSettings : public UDeveloperSettings
{
	GENERATED_BODY()

public:

	UCSUnrealSharpEditorSettings();
	
	// Whether Hot Reload should automatically start on script save, gaining Editor focus, or not at all.
	UPROPERTY(EditDefaultsOnly, config, Category = "UnrealSharp | Hot Reload")
	TEnumAsByte<EAutomaticHotReloadMethod> AutomaticHotReloading = OnScriptSave;

	// The build configuration to use when building the C# project in the editor.
	UPROPERTY(EditDefaultsOnly, config, Category = "UnrealSharp | Hot Reload")
	TEnumAsByte<ECSBuildConfiguration> BuildConfiguration = ECSBuildConfiguration::Debug;

	// The verbosity level of the logs generated by MSBuild when building the C# project in the editor.
	UPROPERTY(EditDefaultsOnly, config, Category = "UnrealSharp | Hot Reload")
	TEnumAsByte<ECSLoggerVerbosity> LogVerbosity = ECSLoggerVerbosity::Normal;

	// Should we suffix generated types' DisplayName with "TypeName (C#)"?
	// Needs restart to take effect.
	UPROPERTY(EditDefaultsOnly, config, Category = "UnrealSharp | Type Generation")
	bool bSuffixGeneratedTypes = false;

	FString GetBuildConfigurationString() const;

	FString GetLogVerbosityString() const;
};
